package com.application.mestory.mapper;

import com.application.mestory.entity.MeStory;
import com.application.mestory.entity.MeStoryObject;
import com.application.mestory.jaxb.Story;
import com.application.mestory.jaxb.StoryObject;

public class StoryToMeStory {

	static public MeStory map(Story story) {
		MeStory meStory = new MeStory();
		meStory.setId(story.getSid());
		for (StoryObject storyObject: story.getStoryObjects()) {
			MeStoryObject meStoryObject = new MeStoryObject();
			meStoryObject.setHeight(storyObject.getHeight());
			meStoryObject.setImageName(storyObject.getImageName());
			meStoryObject.setLeft(storyObject.getLeft());
			meStoryObject.setId(storyObject.getSoid());
			meStoryObject.setTop(storyObject.getTop());
			meStoryObject.setWidth(storyObject.getWidth());
			meStory.addStoryObject(meStoryObject);		
		}
		return meStory;
	}
}
